// c:\users\de'l'l\desktop\lkchongxie\重写\pages\keduResult\keduResult
Page({
    data: {
        tools: [{
            name: '身体质量指数BMI',
            image: 'http://fcdn.qiushilaile.com/game/default-10121630635799293.jpg',
            bg: 'http://fcdn.qiushilaile.com/game/default-54861630635965891.jpg',
            btn: 'http://fcdn.qiushilaile.com/game/default-2621630635985498.png',
            value: '1',
            person: '123',
        }, {
            name: '中心性肥胖标准',
            image: 'http://fcdn.qiushilaile.com/game/default-53611630636085250.jpg',
            bg: 'http://fcdn.qiushilaile.com/game/default-12351630636097854.jpg',
            btn: 'http://fcdn.qiushilaile.com/game/default-53651630636105582.png',
            value: '2',
            person: '242',
        }, {
            name: '身体脂肪率',
            image: 'http://fcdn.qiushilaile.com/game/default-25431630636121182.jpg',
            bg: 'http://fcdn.qiushilaile.com/game/default-3741630636128869.jpg',
            btn: 'http://fcdn.qiushilaile.com/game/default-13211630636141474.png',
            value: '3',
            person: '66',
        }, {
            name: '每日所需卡路里',
            image: 'http://fcdn.qiushilaile.com/game/default-40711630636156746.jpg',
            bg: 'http://fcdn.qiushilaile.com/game/default-16581630636165497.jpg',
            btn: 'http://fcdn.qiushilaile.com/game/default-73891630636172100.png',
            value: '4',
            person: '56',
        }, {
            name: '健康体重范围',
            image: 'http://fcdn.qiushilaile.com/game/default-21981630636185582.jpg',
            bg: 'http://fcdn.qiushilaile.com/game/default-57741630636194597.jpg',
            btn: 'http://fcdn.qiushilaile.com/game/default-55311630636201332.png',
            value: '5',
            person: '123',
        }, {
            name: '运动健身补水',
            image: 'http://fcdn.qiushilaile.com/game/default-61671630636214269.jpg',
            bg: 'http://fcdn.qiushilaile.com/game/default-76661630636222595.jpg',
            btn: 'http://fcdn.qiushilaile.com/game/default-70831630636229698.png',
            value: '6',
            person: '123',
        }, {
            name: '跑步卡路里消耗',
            image: 'http://fcdn.qiushilaile.com/game/default-24311630636248876.jpg',
            bg: 'http://fcdn.qiushilaile.com/game/default-85541630636258270.jpg',
            btn: 'http://fcdn.qiushilaile.com/game/default-26551630636265646.png',
            value: '7',
            person: '123',
        }, ],
    },
    onLoad: function(options) {
        console.log(options);
        if (options.sex == 'man') {
            if (options.age < 30.9) {
                this.setData({
                    value: 680
                })
            } else if (options.age > 60.9) {
                this.setData({
                    value: 490
                })
            } else {
                this.setData({
                    value: 830
                })
            }
        } else {
            if (options.age < 30.9) {
                this.setData({
                    value: 450
                })
            } else if (options.age > 60.9) {
                this.setData({
                    value: 600
                })
            } else {
                this.setData({
                    value: 830
                })
            }
        }
        let num = this.data.value + 9.563 * (options.weight) + 1.85 * (options.height) + 4.676 * (options.age);
        console.log(num);
        this.setData({
            num: num.toFixed(1)
        })
    },
    clickTest(e) {
        console.log(e.currentTarget.dataset);
        let {
            name,
            value,
            bg,
            btn,
        } = e.currentTarget.dataset
        tt.navigateTo({
            url: '/pages/testing/testing?title=' + name +
                '&value=' + value +
                '&bg=' + bg +
                '&btn=' + btn
        });
    },
})